package com.x.Part3_inherit;

/**
 * ClassName: inherit2
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2023/9/26 21:06
 */

public class inherit2 {
    public static void main(String[] args) {
        Student2 s = new Student2("Xiao Ming", 12, 89);
    }
}

class Person2 {
    protected String name;
    protected int age;

    public Person2(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

class Student2 extends Person2 {
    protected int score;

    public Student2(String name, int age, int score) {
        super(name, age);//先调用父类构造器，子类构造器才能被调用
        this.score = score;
    }
}
